#

| Chapter 22 File Security, Ownership, and Sharing |

## 22.8 The Handy chmod = Operator

Let's say you have a set of files. Some are writable by you, others are read-only. You want to give people in your group the same permissions you have - that is, they can write writable files but can only read the read-only files. It's easy with an underdocumented feature of chmod:

>     % chmod g=u *

That means "for all files (`*`), set the group permissions (`g`) to be the same as the owner permissions (`u`)." You can also use the letter `o` for others, which is everyone who's not the owner or in the owner's group. Article 22.2 explains these categories.

If your chmod has a -R (recursive) option, you can make the same change to all files and directories in your current directory and beneath. If you don't have chmod -R, use this find (17.10):

>     % find . -exec chmod g=u {} \;

The cpmod (22.16) program on the CD-ROM can copy all file permissions.

- JP

22.7 Using chmod to Change File Permission |  | 22.9 Protect Important Files: Make Them Unwritable